Problem Note 40771: The DATA Step FILENAME function does not work correctly on UNIX
When using the DATA Step FILENAME function on Unix, if the second
parameter (the file name) is a SAS variable that has a length of more
than 1025 characters, then the FILEREF that is created will point to
the file name in the function as well as to the directory that SAS
was started from.
Here is an example.
length path $2000;
path = "/temp";
rc = filename("fname", path);
The fname FILEREF will point to /temp and to the path that SAS was
started from.
This can cause other functions that use the FILEREF (such as DNUM,
DINFO, DOPTNAME, DOPTNUM, DREAD, FEXIST) to return incorrect values.
The work-around for this problem is to either make the length of the
variable less than $1026, or to add a STRIP() function around the
variable when it is used with the FILENAME function. For example,
either of these will work correctly:
length path $1025; path = "/temp"; rc = filename("fname", path);
-OR-
length path $2000;
path = "/temp";
rc = filename("fname", strip(path));
Operating System and Release Information
SAS System | Base SAS | 64-bit Enabled AIX | 9.21_M3 | 9.3 | 9.2 TS2M3 | 9.3 TS1M0 |
64-bit Enabled HP-UX | 9.21_M3 | 9.3 | 9.2 TS2M3 | 9.3 TS1M0 |
64-bit Enabled Solaris | 9.21_M3 | 9.3 | 9.2 TS2M3 | 9.3 TS1M0 |
HP-UX IPF | 9.21_M3 | 9.3 | 9.2 TS2M3 | 9.3 TS1M0 |
Linux | 9.21_M3 | 9.3 | 9.2 TS2M3 | 9.3 TS1M0 |
Linux for x64 | 9.21_M3 | 9.3 | 9.2 TS2M3 | 9.3 TS1M0 |
OpenVMS on HP Integrity | 9.21_M3 | 9.3 | 9.2 TS2M3 | 9.3 TS1M0 |
Solaris for x64 | 9.21_M3 | 9.3 | 9.2 TS2M3 | 9.3 TS1M0 |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
Type: | Problem Note |
Priority: | low |
Topic: | SAS Reference ==> Functions ==> External Files ==> FILENAME
|
Date Modified: | 2010-09-02 12:51:38 |
Date Created: | 2010-09-02 10:53:19 |